<?php

// 9/50/2009: immanuel192 rewrite this class

if (!defined("EXPONENT")) exit("");

$gallery = null;
if (isset($_GET['id'])) {
	$gallery = $db->selectObject("imagegallery_gallery","id=".$_GET['id']);
	$loc = unserialize($gallery->location_data);
	$loc->int = $gallery->id;
}

if (exponent_permissions_check("edit",$loc)) {
	//deprecated for Form controls
	$form = imagegallery_gallery::form($gallery);
	$form->location($loc);
	$form->meta("action","save_gallery");
	
	$template = new template("imagegallerymodule","_form_editgallery",$loc);
	$template->assign("is_edit",(isset($gallery->id) ? 1 : 0));
	if($gallery) $template->assign("gallery",$gallery);
	$template->assign("form_html",$form->toHTML());
	$template->output();
}

?>